import time
from pictures.pictures import create_jpg
from down.down import down_tile

if __name__ == '__main__':
    # 同步下载会覆盖文件
    print("开始运行")
    # base_url = "http://map.geoq.cn/ArcGIS/rest/services/ChinaOnlineCommunity/MapServer/tile/{z}/{y}/{x}"
    base_url = "http://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}"
    target_folder = r'E:\FFOutput'
    min_level = 10
    max_level = 10
    start = time.time()
    # 下载影像,115.858099,36.551322
    down_tile(min_level, max_level, 31.876809, 36.551322, 110.265321, 115.858099, target_folder, base_url)
    # 将影像合成为一张图片,将图片转为tif，并设置投影

    tif_path = create_jpg(target_folder, max_level)

    print(tif_path)

    end = time.time()
    print(end - start)
    print("完成")
